package com.darren.euc.dao.impl;


import java.math.BigInteger;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.darren.euc.dao.MessageClientEndDao;
import com.darren.euc.entity.MessageClientEnd;


@Repository
public class MessageClientEndDaoImpl extends BaseDaoImpl<MessageClientEnd, Integer> implements MessageClientEndDao {
	
	@Override
	public BigInteger getUnreadCount(Integer userId){
		Session session = sessionFactory.getCurrentSession();	
		Query query  = session.createSQLQuery(" select count(1) from euc_message_client_end where message_status = 0 and user_id = ? ; ");
		query.setParameter(0, userId);
		BigInteger count = (BigInteger) query.uniqueResult();
		return  count;
	}
	
}